package com.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="user")
public class User {
	private int id;
	private String username;
	private String password;
	private String sex;
	private String address;
	private String phone;
	private String hobby;
	private int account;
	private Set<Pets> pets=new HashSet<Pets>();
	
	public User(){
		
	}
	
	public User(int id, String username, String password, String sex, String address, String phone, String hobby,
			int account, Set<Pets> pets) {
		super();
		this.id = id;
		this.username = username;
		this.password = password;
		this.sex = sex;
		this.address = address;
		this.phone = phone;
		this.hobby = hobby;
		this.account = account;
		this.pets = pets;
	}


	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	@Column(name="username")
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	@Column(name="password")
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	@Column(name="sex")
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	@Column(name="address")
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	@Column(name="phone")
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Column(name="hobby")
	public String getHobby() {
		return hobby;
	}
	public void setHobby(String hobby) {
		this.hobby = hobby;
	}
	
	@Column(name="account")
	public int getAccount() {
		return account;
	}
	public void setAccount(Integer account) {
		this.account = account;
	}
	@OneToMany(cascade={CascadeType.ALL})
	@JoinColumn(name = "uid")
	public Set<Pets> getPets() {
		return pets;
	}
	public void setPets(Set<Pets> pets) {
		this.pets = pets;
	}


	@Override
	public String toString() {
		return "User [id=" + id + ", username=" + username + ", password=" + password + ", sex=" + sex + ", address="
				+ address + ", phone=" + phone + ", hobby=" + hobby + ", account=" + account + ", pets=" + pets + "]";
	}
	
	
	

}
